#pragma once

#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>

#define PIPE_NAME "namedpipe"

using namespace std;

void createNamedPipe()
{
    int n = mkfifo(PIPE_NAME, 0600);
    if (n != 0)
    {
        cout << "error: " << strerror(errno) << endl;
        exit(-1); 
    }
}

void removeNamedPipe()
{
    int n = unlink(PIPE_NAME);
    if (n != 0)
    {
        cout << "error: " << strerror(errno) << endl;
        exit(-1);
    }
}